package com.example.file_management.service;

import com.example.file_management.mapper.material.SelfCheckMapper;
import com.example.file_management.pojo.material.SelfCheck;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class SelfCheckService {

    private final SelfCheckMapper selfCheckMapper;

    @Autowired
    public SelfCheckService(SelfCheckMapper selfCheckMapper) {
        this.selfCheckMapper = selfCheckMapper;
    }

    // 插入自检记录
    public int insertSelfInspection(SelfCheck selfCheck) {
        return selfCheckMapper.insertSelfInspection(selfCheck);
    }

    // 根据任务ID查询自检记录
    public List<SelfCheck> getSelfInspectionsByTaskId(int taskId) {
        return selfCheckMapper.getSelfInspectionsByTaskId(taskId);
    }

    // 更新自检记录
    public int updateSelfInspection(SelfCheck selfCheck) {
        return selfCheckMapper.updateSelfInspection(selfCheck);
    }

    // 根据自检ID删除自检记录
    public int deleteSelfInspection(int selfCheckId) {
        return selfCheckMapper.deleteSelfInspection(selfCheckId);
    }
}